#include "user.h"

// User 类的实现
User::User(int id, const std::string& name, const std::string& password)
    : id(id), name(name), password(password) {}

int User::getId() const { return id; }
std::string User::getName() const { return name; }
void User::setName(const std::string& newName) { name = newName; }
std::string User::getPassword() const { return password; }
void User::setPassword(const std::string& newPassword) { password = newPassword; }

void User::displayInfo() const {
    std::cout << "ID: " << id << ", Name: " << name << std::endl;
}

// RegularCustomer 类的实现
RegularCustomer::RegularCustomer(int id, const std::string& name, const std::string& password)
    : User(id, name, password) {}

void RegularCustomer::displayInfo() const {
    User::displayInfo();
    std::cout << "Type: Regular Customer" << std::endl;
}

std::string RegularCustomer::getType() const { return "RegularCustomer"; }

std::string RegularCustomer::serialize() const {
    return std::to_string(id) + ", " + name;
}

int RegularCustomer::getMaxRentCount() const { return 3; }
int RegularCustomer::getMaxRentDuration() const { return 7; }

// VIPCustomer 类的实现
VIPCustomer::VIPCustomer(int id, const std::string& name, const std::string& password)
    : User(id, name, password) {}

void VIPCustomer::displayInfo() const {
    User::displayInfo();
    std::cout << "Type: VIP Customer" << std::endl;
}

std::string VIPCustomer::getType() const { return "VIPCustomer"; }

std::string VIPCustomer::serialize() const {
    return  std::to_string(id) + ", " + name;
}

int VIPCustomer::getMaxRentCount() const { return 5; }
int VIPCustomer::getMaxRentDuration() const { return 14; }

// Admin 类的实现
Admin::Admin(int id, const std::string& name, const std::string& password)
    : User(id, name, password) {}

void Admin::displayInfo() const {
    User::displayInfo();
    std::cout << "Type: Admin" << std::endl;
}

std::string Admin::getType() const { return "Admin"; }

std::string Admin::serialize() const {
    return std::to_string(id) + ", " + name;
}


int Admin::getMaxRentCount() const { return 0; }
int Admin::getMaxRentDuration() const { return 0; }

// RentalStaff 类的实现
RentalStaff::RentalStaff(int id, const std::string& name, const std::string& password)
    : User(id, name, password) {}

void RentalStaff::displayInfo() const {
    User::displayInfo();
    std::cout << "Type: Rental Staff" << std::endl;
}

std::string RentalStaff::getType() const { return "RentalStaff"; }

std::string RentalStaff::serialize() const {
    return  std::to_string(id) + ", " + name;
}

int RentalStaff::getMaxRentCount() const { return 0; }
int RentalStaff::getMaxRentDuration() const { return 0; }    